<%@ page import="java.util.List" %>
<%@ page import="com.lczyfz.istep.modules.resource.entity.ResourceQuestion" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>

<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>我的考试</title>
    <script type="text/javascript" src="${path}/js/resource/jquery.min.js"></script>
    <script type="text/javascript" src="${path}/js/resource/bootstrap.min.js"></script>
    <script type="text/javascript" src="${path}/js/resource/icheck.js"></script>
    <link rel="stylesheet" href="${path}/css/resource/bootstrap.min.css">
    <link rel="stylesheet" href="${path}/css/resource/blue.css">
    <script type="text/javascript">
        $(document).ready(function(){
//            弹框提示次数是否用尽
            var stuDoCount00=document.getElementById('stuDoCount').value;
            console.info(stuDoCount00);
//            if(stuDoCount00.equals("0")){
            if(stuDoCount00=="0"){
                alert("考试次数已用尽！");
                console.info("考试次数已用尽！");
                window.location.href="${ctx}/teach/teachStudentPaper/stuExamList/";
            }

//            弹框提示次数是否用尽

            document.getElementById('teachExamEndDate').value="${teachExamEndDate}";
            $('input').iCheck({
                checkboxClass: 'icheckbox_square-blue',
                radioClass: 'iradio_square-blue',
                increaseArea: '20%'
            });

            $("#inputForm").validate({
                submitHandler: function(form){
                    loading('正在提交，请稍等...');
                    form.submit();
                },
                errorContainer: "#messageBox",
                errorPlacement: function(error, element) {
                    $("#messageBox").text("输入有误，请先更正。");
                    if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
                        error.appendTo(element.parent().parent());
                    } else {
                        error.insertAfter(element);
                    }
                }
            });
        });

        //获取每一题的一组单选框的值（获取某道题目的答题情况）
        //    function
        function getAllAnswer(){
            var labelBnt="tijiao";
            document.getElementById("labelBnt").value = labelBnt;
            var answerTotalString="";
            $(".resourceQuestionIdListRa").each(function () {
                answerTotalString=answerTotalString+$(this).val()+"(!(Question|#|StudentAnswer)!)"+getRadioValue($(this).val())+"#(#endQuestion#)#";
            });
            answerCB=getCheckBoxAnswer();
            answerTotalString=answerTotalString+answerCB;
            answerYN=getRadioYNAnswer();
            answerTotalString=answerTotalString+answerYN;
            answerEa=getTextEAAnswer();
            answerTotalString=answerTotalString+answerEa;
            console.info(answerTotalString);
            document.getElementById("answerTotalToString").value = answerTotalString;
            document.getElementById("questionCount").value = questionCount();
        }

        //获取每一题的一组单选框的值（获取某道题目的答题情况）
        //    function保存
        function getAllAnswer0(){
            var labelBnt="baocun";
            document.getElementById("labelBnt").value = labelBnt;
            var answerTotalString="";
            $(".resourceQuestionIdListRa").each(function () {
//        answerTotalString=answerTotalString+"(*(beginQuestion)*)"+$(this).val()+"(!(Question|#|StudentAnswer)!)"+getRadioValue($(this).val())+"#(#endQuestion#)#";
                answerTotalString=answerTotalString+$(this).val()+"(!(Question|#|StudentAnswer)!)"+getRadioValue($(this).val())+"#(#endQuestion#)#";
            });
            answerCB=getCheckBoxAnswer();
            answerTotalString=answerTotalString+answerCB;
            answerYN=getRadioYNAnswer();
            answerTotalString=answerTotalString+answerYN;
//      var answerEa="";
            answerEa=getTextEAAnswer();
            answerTotalString=answerTotalString+answerEa;
            console.info(answerTotalString);
            document.getElementById("answerTotalToString").value = answerTotalString;
            document.getElementById("questionCount").value = questionCount();
        }



        function questionCount(){
            var questionCount=0;
            $(".resourceQuestionCount").each(function () {
                questionCount=questionCount+1;
            });
            return questionCount;
        }
        function getCheckBoxAnswer(){
            var answerCB="";
            $(".resourceQuestionIdListCB").each(function () {
//        answerCB=answerCB+"(*(beginQuestion)*)"+$(this).val()+"(!(Question|#|StudentAnswer)!)"+getCheckBoxValue($(this).val())+"#(#endQuestion#)#";
                answerCB=answerCB+$(this).val()+"(!(Question|#|StudentAnswer)!)"+getCheckBoxValue($(this).val())+"#(#endQuestion#)#";
            });
            return answerCB;
        }
        function getRadioYNAnswer(){
            var answerYN="";
            $(".resourceQuestionIdListYN").each(function () {
//        answerYN=answerYN+"(*(beginQuestion)*)"+$(this).val()+"(!(Question|#|StudentAnswer)!)"+getRadioValue($(this).val())+"#(#endQuestion#)#";
                answerYN=answerYN+$(this).val()+"(!(Question|#|StudentAnswer)!)"+getRadioValue($(this).val())+"#(#endQuestion#)#";
            });
            return answerYN;
        }
        function getTextEAAnswer(){
            var answerEA="";
            $(".resourceQuestionIdListEA").each(function () {
//        answerEA=answerEA+"(*(beginQuestion)*)"+$(this).val()+"(!(Question|#|StudentAnswer)!)"+getTextEAValue($(this).val())+"#(#endQuestion#)#";
//                answerEA=answerEA+$(this).val()+"(!(Question|#|StudentAnswer)!)"+getTextEAValue($(this).val())+"#(#endQuestion#)#";
                answerEA=answerEA+$(this).val()+"(!(Question|#|StudentAnswer)!)"+$('#'+$(this).val()).val()+"#(#endQuestion#)#";

            });
//      console.info(answerEA);
            return answerEA;
        }

        function getTextEAValue(name){
//            var textEA =document.getElementById(name).value;
            var textEA =$("#name").val();
//            var textEA =document.getElementsByName(name);
//             if(textEA==null)console.info("null");
//             console.info(textEA);
            return textEA;
        }


        //获取所有的单选框的name（name和quewtionId是一样的）。。。每个name值传入getRadioValue(name)
        function getRadioValue(name){
            var radioes = document.getElementsByName(name);
            var ans="";
            for(var i=0;i<radioes.length;i++)
            {
                if(radioes[i].checked){
                    ans=ans+radioes[i].value;
                }
            }
            return ans;
        }
        function getCheckBoxValue(name){
            var checkBoxes = document.getElementsByName(name);
            var ansCB="";
            for(var i=0;i<checkBoxes.length;i++)
            {
                if(checkBoxes[i].checked==true){
                    ansCB=ansCB+checkBoxes[i].value;
                }
            }
            return ansCB;
        }

        //    倒计时
        function DigitalTime1()
        {
            var deadline= new Date(document.getElementsByName(teachExamEndDate));
            var symbol=document.getElementsByName(teachExamEndDate);
            var now = new Date();
            var aa=deadline-now;
            var diff = - now.getTimezoneOffset();
            var leave = (deadline.getTime() - now.getTime()) + diff*60000;
            var day = Math.floor(leave / (1000 * 60 * 60 * 24));
            var hour = Math.floor(leave / (1000*3600)) - (day * 24);
            var minute = Math.floor(leave / (1000*60)) - (day * 24 *60) - (hour * 60);
            var second = Math.floor(leave / (1000)) - (day * 24 *60*60) - (hour * 60 * 60) - (minute*60);
            day=day+1;
            if (day>0) //还未开幕
            {
                LiveClock1.innerHTML = "现在离"+symbol+"还有"+day+"天"+hour+"小时"+minute+"分"+second +"秒";
                setTimeout("DigitalTime1()",1000);
            }

        }


        function GetRTime(){
            var teachExamEndDate=document.getElementById('teachExamEndDate').value;
            var EndTime= new Date(teachExamEndDate);
            var NowTime = new Date();
            var t =EndTime.getTime() - NowTime.getTime();
            var d=0;
            var h=0;
            var m=0;
            var s=0;
            if(t>=0){
                d=Math.floor(t/1000/60/60/24);
                h=Math.floor(t/1000/60/60%24);
                m=Math.floor(t/1000/60%60);
                s=Math.floor(t/1000%60);
            }else{
                getAllAnswer();
//        var id=document.getElementById('sceneEnvironmentInstanceId').value;
                var paperId=document.getElementById('paperId').value;
                var answerTotalToString=document.getElementById('answerTotalToString').value;
                var questionCount=document.getElementById('questionCount').value;
//          var labelBnt=document.getElementById('labelBnt').value;
                clearInterval(auto);
                end(paperId,answerTotalToString,questionCount);
            }
            if(d<10)
                d="0"+d;
            if(h<10)
                h="0"+h;
            if(m<10)
                m="0"+m;
            if(s<10)
                s="0"+s;
            document.getElementById("t_d").innerHTML = d ;
            document.getElementById("t_h").innerHTML = h ;
            document.getElementById("t_m").innerHTML = m ;
            document.getElementById("t_s").innerHTML = s ;


        }
        auto= setInterval(GetRTime,0);
        function end(paperId,answerTotalToString,questionCount){
            alert("答题时间已用尽！");
            $.ajax({
                type: "POST",
                url: "${ctx}/teach/teachStudentPaper/answerSave",
                data: {
                    paperId:paperId,
                    answerTotalToString:answerTotalToString,
                    questionCount:questionCount

                }
            });
//到答题时间自动进行答案的保存，并返回答题列表。
            window.location="${ctx}/teach/teachStudentPaper/stuExamList/";
        }

        function countEnd(paperId,answerTotalToString,questionCount){
            alert("考试次数已用尽！");
            $.ajax({
                type: "POST",
                url: "${ctx}/teach/teachStudentPaper/answerSave",
                data: {
                    paperId:paperId,
                    answerTotalToString:answerTotalToString,
                    questionCount:questionCount

                }
            });
//到答题时间自动进行答案的保存，并返回答题列表。
            window.location="${ctx}/teach/teachStudentPaper/stuExamList/";
        }

    </script>
    <style type="text/css">
        .b {
            font-weight:bold;
        }
        .infot {
            margin-left: 75px;
        }
        .iradio_square-blue {
            width: 24px;
            height: 24px;
            background: url(${path}/static/images/blue.png) no-repeat;
            background-position: -120px 0;
        }
        .icheckbox_square-blue {
            width: 24px;
            height: 24px;
            background: url(${path}/static/images/blue.png) no-repeat;
        }
        .choicea{
            font-size: 17px;
        }
        .choice{
            /*margin-left: 50px;*/
            /*font-size: 17px;*/
            margin-left: 15px;
            margin-top: 10px;
            font-size: 17px;
        }
        .tborder{
            border:1px  dotted #66B3FF;
            margin-right: 300px;
            margin-left: 80px;
        }
    </style>

    <script>
        //进入实验
        function experimentOperate(resourceQuestionId)
        {
            var toUrl;
            $.ajax({
                type: "POST",
                url: "${ctx}/scene/sceneEnvironment/isExperimentExistPaper",
                data: {
                    resourceQuestionId:resourceQuestionId
                },
                success: function (jsonModel) {
                    var msg=jsonModel.msg;
                    var instanceId=jsonModel.dataObj;
                    if(msg=='2')
                    {

                        $.mbox({
                            area: [ "450px", "auto" ], //弹框大小
                            border: [ 0, .5, "#666" ],
                            dialog: {
                                msg: "已经存在实验，是否跳转至该课程完成实验?",
                                btns: 2,   //1: 只有一个按钮   2：两个按钮  3：没有按钮 提示框
                                type: 2,   //1:对钩   2：问号  3：叹号
                                btn: [ "原实验", "新实验"],  //自定义按钮
                                yes: function() {  //点击左侧按钮：成功
                                    msg='4';
                                    toUrl = "${ctx}/scene/sceneEnvironment/toExperimentOperateViewPaper?instanceId="+instanceId+"&msg="+msg+"&resourceQuestionId="+resourceQuestionId;
                                },
                                no: function() { //点击右侧按钮：失败
                                    msg='5';
                                    toUrl = "${ctx}/scene/sceneEnvironment/toExperimentOperateViewPaper?instanceId="+instanceId+"&msg="+msg+"&resourceQuestionId="+resourceQuestionId;

                                }
                            }
                        });
                    }
                    else{
                        toUrl = "${ctx}/scene/sceneEnvironment/toExperimentOperateViewPaper?instanceId="+instanceId+"&msg="+msg+"&resourceQuestionId="+resourceQuestionId;
                    }

                },
                error:function(){
                }
            });
            var newWin = window.open("${ctx}/scene/sceneEnvironment/toSceneExperimentOperationWait","_blank");
            $.ajax().done(function() {
                // 重定向到目标页面
                newWin.location.href = toUrl;
            });

        }
    </script>

</head>

<body  onload=DigitalTime1()>
<ul class="nav nav-tabs">
    <li><a href="${ctx}/teach/teachStudentPaper/stuExamList/">考试列表</a></li>

    <li class="active">
        <a>
            答题中
        </a>
    </li>
</ul><br/>
<form:form id="inputForm" modelAttribute="resourcePaper" action="${ctx}/teach/teachStudentPaper/answerSave" method="post" class="form-horizontal">

<input type="hidden"  name="labelBnt" id="labelBnt" value="${labelBnt}">
<input type="hidden"  name="paperId" id="paperId" value="${paperId}">
<input type="hidden"  name="examId" id="examId" value="${examId}">
<input type="hidden" name="answerTotalToString" id="answerTotalToString" value=${answerTotalString}>
<input type="hidden" name="questionCount" id="questionCount" value=${questionCount}>
<%--AlisaYe--%>
<input type="hidden"  name="stuDoCount" id="stuDoCount" value="${stuDoCount}">

<c:set var="resourceQuestionCount" value="0" />
<c:forEach var="resourceQuestion" items="${resourceQuestionList}">
    <c:set var="resourceQuestionCount" value="${resourceQuestionCount+1}" />
    <input type="hidden" class="resourceQuestionCount" value="${resourceQuestionCount}">
</c:forEach>

<div class="container-fluid">

    <div class="row">
        <div class="col-md-10">
            <div class="row">
                <%--<div class="col-md-3 col-md-offset-2">--%>
                    <div class="col-md-5 col-md-offset-2">
                    <h3 class="b">试卷名称：${resourcePaper.paperName}</h3>
                </div>
                <%--<div class="col-md-4 ">--%>
                    <%--<h3 class="infot b">总分：${resourcePaper.totalScore}</h3>--%>
                        <%--&lt;%&ndash;${teachStudentPaper}&ndash;%&gt;--%>
                <%--</div>--%>

            </div>
            <div class="row">
            <div class="col-lg-10 bor " style="margin-left:30px">
                <lable id="time" style="color:#FF0000;font-weight:bold">
                    剩余时间：   
                    <span id="t_d">00</span>天
                     	<span id="t_h">00</span>时
                        <span id="t_m">00</span>分
                        <span id="t_s">00</span>秒
                </lable>
                <input type="hidden" class="teachExamEndDate" id="teachExamEndDate" value="${teachExamEndDate}" >
            </div>
            </div>
                <%--<div class="row" id= LiveClock1>--%>
                <%--倒计时 ${teachExamEndDate}--%>
                <%--<input type="hidden" name="oooDate" id="oooDate" >${oooDate}--%>
                <%--</div>--%>

            <div class="row">
                <div class="col-md-2  col-md-offset-1" >
                    <h4 class="b">一、单选题</h4>
                </div>
                <div class="col-md-2  col-md-offset-1">
                    <c:set var="index" value="0" />
                    <c:forEach var="resourceQuestion" items="${resourceQuestionList}">
                        <c:if test="${resourceQuestion.questionType == '0' }">
                            <c:set var="index" value="${index+1}" />
                        </c:if>
                    </c:forEach>
                    <h4 class="b">题目数量：${index}</h4>
                </div>
                <div class="col-md-2  col-md-offset-1">
                    <h4 class="b">每题分值：
                        <c:if test="${resourcePaper.paperType == '1'}">
                        <c:if test="${resourceQuestionListRadio!=null&&fn:length(resourceQuestionListRadio)!=0}">${resourceQuestionListRadio[0].questionScore}</c:if></h4>
                    </c:if>
                    <c:if test="${resourcePaper.paperType == '2'}">
                        <c:if test="${resourcePaper.radioScore!=null}">${resourcePaper.radioScore}</c:if></h4>
                        </c:if>
                    </h4>
                    <%--这里的分值是从数据库里出来的，待修改--%>
                </div>
            </div>

            <div class="col-md-offset-1" style="padding-left: 15px;">
                <c:set var="index" value="0" />
                <c:forEach var="resourceQuestion" items="${resourceQuestionList}">
                    <c:set var="indexAns" value="${resourceQuestion.id}" />
                    <div class="row choicea">
                        <c:if test="${resourceQuestion.questionType == '0' }">
                            <input type="hidden" class="resourceQuestionIdList" value="${resourceQuestion.id}">
                            <input type="hidden" class="resourceQuestionIdListRa" value="${resourceQuestion.id}">
                            <c:set var="index" value="${index+1}" />
                            ${index}、${resourceQuestion.stem}

                            <c:if test="${resourceQuestion!=null&&resourceQuestion.environmentId!=null&&resourceQuestion.environmentId!=''}">
                                <a style="" href="javascript:experimentOperate('${resourceQuestion.id}')">进入实验</a>
                            </c:if>
                            <div class="row" >
                                <br>

                                <%--<c:forEach var="teachStudentPaper" items="${teachStudentPaper}">--%>
                                    <%--<c:if test="${teachStudentPaper.questionId == indexAns }">--%>
                                        <%--<c:set var="answer" value="${teachStudentPaper.answer}" />--%>
                                        <%--&lt;%&ndash;<c:set var="quesId" value="${0}" />&ndash;%&gt;--%>
                                        <%--<div class="choicea col-md-2" >--%>
                                            <%--<c:set var="value" value="a" />--%>
                                            <%--<c:set var="status" value="${teachStudentPaper.answer.equals(value) }" />--%>
                                            <%--<input type="radio" name="${indexAns}"  value="a"  <c:if test="${answer eq value}"> checked="checked"</c:if> > A、${resourceQuestion.option.optionA}--%>
                                        <%--</div>--%>
                                        <%--<div class="choice col-md-2" >--%>
                                            <%--<c:set var="value" value="b" />--%>
                                            <%--<input type="radio" name="${indexAns}"  value="b"  <c:if test="${answer eq value}"> checked="checked"</c:if> > B、${resourceQuestion.option.optionB}--%>
                                        <%--</div>--%>
                                        <%--<div class="choice col-md-2" >--%>
                                            <%--<c:set var="value" value="c" />--%>
                                            <%--<input type="radio" name="${indexAns}" value="c"  <c:if test="${answer eq value}"> checked="checked"</c:if>  > C、${resourceQuestion.option.optionC}--%>
                                        <%--</div>--%>
                                        <%--<div class="choice col-md-2" >--%>
                                            <%--<c:set var="value" value="d" />--%>
                                            <%--<input type="radio" name="${indexAns}"  value="d" <c:if test="${answer eq value}"> checked="checked"</c:if> > D、${resourceQuestion.option.optionD}--%>
                                        <%--</div>--%>
                                    <%--</c:if>--%>
                                <%--</c:forEach>--%>

                                <%--AlisaYe20170703--%>
                                        <%--<div class="choicea col-md-2" >--%>
                                            <%--<c:set var="value" value="a" />--%>
                                            <%--<c:forEach var="teachStudentPaper" items="${teachStudentPaper}">--%>
                                            <%--<c:if test="${teachStudentPaper.questionId == indexAns }">--%>
                                            <%--<c:set var="answer" value="${teachStudentPaper.answer}" />--%>
                                            <%--<input type="radio" name="${indexAns}"  value="a"  <c:if test="${answer eq value}"> checked="checked"</c:if> >--%>
                                            <%--</c:if>--%>
                                            <%--</c:forEach>--%>
                                            <%--A、${resourceQuestion.option.optionA}--%>
                                        <%--</div>--%>
                                        <%--<div class="choice col-md-2" >--%>
                                            <%--<c:set var="value" value="b" />--%>
                                            <%--<c:forEach var="teachStudentPaper" items="${teachStudentPaper}">--%>
                                            <%--<c:if test="${teachStudentPaper.questionId == indexAns }">--%>
                                            <%--<c:set var="answer" value="${teachStudentPaper.answer}" />--%>
                                            <%--<input type="radio" name="${indexAns}"  value="b"  <c:if test="${answer eq value}"> checked="checked"</c:if> >--%>
                                            <%--</c:if>--%>
                                            <%--</c:forEach>--%>
                                            <%--B、${resourceQuestion.option.optionB}--%>
                                        <%--</div>--%>
                                        <%--<div class="choice col-md-2" >--%>
                                            <%--<c:set var="value" value="c" />--%>
                                            <%--<c:forEach var="teachStudentPaper" items="${teachStudentPaper}">--%>
                                            <%--<c:if test="${teachStudentPaper.questionId == indexAns }">--%>
                                            <%--<c:set var="answer" value="${teachStudentPaper.answer}" />--%>
                                            <%--<input type="radio" name="${indexAns}" value="c"  <c:if test="${answer eq value}"> checked="checked"</c:if>  >--%>
                                            <%--C、${resourceQuestion.option.optionC}--%>
                                            <%--</c:if>--%>
                                            <%--</c:forEach>--%>
                                        <%--</div>--%>
                                        <%--<div class="choice col-md-2" >--%>
                                            <%--<c:set var="value" value="d" />--%>
                                            <%--<c:forEach var="teachStudentPaper" items="${teachStudentPaper}">--%>
                                            <%--<c:if test="${teachStudentPaper.questionId == indexAns }">--%>
                                            <%--<c:set var="answer" value="${teachStudentPaper.answer}" />--%>
                                            <%--<input type="radio" name="${indexAns}"  value="d" <c:if test="${answer eq value}"> checked="checked"</c:if> >--%>
                                            <%--D、${resourceQuestion.option.optionD}--%>
                                            <%--</c:if>--%>
                                            <%--</c:forEach>--%>
                                        <%--</div>--%>

                                <%---------------------%>
                                <c:forEach var="teachStudentPaper" items="${teachStudentPaper}">
                                <c:if test="${teachStudentPaper.questionId == indexAns }">
                                <c:set var="answer" value="${teachStudentPaper.answer}" />
                                </c:if>
                                </c:forEach>
                                <%--<div class="choicea col-md-2" >--%>
                                <div class="choice" >
                                    <c:set var="value" value="a" />
                                            <input type="radio" name="${indexAns}"  value="a"  <c:if test="${answer eq value}"> checked="checked"</c:if> >
                                    A、${resourceQuestion.option.optionA}
                                </div>
                                <%--<div class="choice col-md-2" >--%>
                                    <div class="choice" >
                                    <c:set var="value" value="b" />
                                            <input type="radio" name="${indexAns}"  value="b"  <c:if test="${answer eq value}"> checked="checked"</c:if> >
                                    B、${resourceQuestion.option.optionB}
                                </div>
                                <%--<div class="choice col-md-2" >--%>
                                    <div class="choice" >
                                    <c:set var="value" value="c" />
                                            <input type="radio" name="${indexAns}" value="c"  <c:if test="${answer eq value}"> checked="checked"</c:if>  >
                                            C、${resourceQuestion.option.optionC}
                                </div>
                                <%--<div class="choice col-md-2" >--%>
                                    <div class="choice" >
                                    <c:set var="value" value="d" />
                                            <input type="radio" name="${indexAns}"  value="d" <c:if test="${answer eq value}"> checked="checked"</c:if> >
                                            D、${resourceQuestion.option.optionD}
                                </div>

                                    <%--AlisaYe20170703--%>



                            </div>
                            <br>

                            <br>
                        </c:if>
                    </div>

                </c:forEach>
            </div>


            <div class="row">
                <div class="col-md-2  col-md-offset-1">
                    <h4 class="b">二、多选题</h4>
                </div>
                <div class="col-md-2 col-md-offset-1">
                    <c:set var="index" value="0" />
                    <c:forEach var="resourceQuestion" items="${resourceQuestionList}">
                        <c:if test="${resourceQuestion.questionType == '1' }">
                            <c:set var="index" value="${index+1}" />
                        </c:if>
                    </c:forEach>
                    <h4 class="b">题目数量：${index}</h4>
                </div>
                <div class="col-md-2 col-md-offset-1">
                    <h4 class="b">每题分值：
                        <c:if test="${resourcePaper.paperType == '1'}">
                            <c:if test="${resourceQuestionListCheckbox!=null&&fn:length(resourceQuestionListCheckbox)!=0}">${resourceQuestionListCheckbox[0].questionScore}</c:if>
                        </c:if>

                        <c:if test="${resourcePaper.paperType == '2'}">
                        <c:if test="${resourcePaper.checkboxScore !=null}">${resourcePaper.checkboxScore}</c:if></h4>
                    </c:if>
                    </h4>

                </div>
            </div>
                <div class="col-md-offset-1" style="padding-left: 30px;">
                    <c:set var="index" value="0" />
                    <c:forEach var="resourceQuestion" items="${resourceQuestionList}">
                        <c:set var="indexAns1" value="${resourceQuestion.id}" />
                        <div class="row  choicea">
                            <c:if test="${resourceQuestion.questionType == '1' }">
                                <input type="hidden" class="resourceQuestionIdList" value="${resourceQuestion.id}">
                                <input type="hidden" class="resourceQuestionIdListCB" value="${resourceQuestion.id}">
                                <c:set var="index" value="${index+1}" />
                                ${index}、${resourceQuestion.stem}
                                <c:if test="${resourceQuestion!=null&&resourceQuestion.environmentId!=null&&resourceQuestion.environmentId!=''}">
                                    <a style="" href="javascript:experimentOperate('${resourceQuestion.id}')">进入实验</a>
                                </c:if>
                                <div class="row ">
                                    <br>
                                    <%--<c:forEach var="teachStudentPaper" items="${teachStudentPaper}">--%>
                                        <%--<c:if test="${teachStudentPaper.questionId == indexAns1 }">--%>
                                            <%--<c:set var="answer" value="${teachStudentPaper.answer}" />--%>
                                            <%--&lt;%&ndash;<c:set var="quesId" value="${1}" />&ndash;%&gt;--%>
                                            <%--<div class="choicea col-md-2" >--%>
                                                <%--<c:set var="value" value="a" />--%>

                                                <%--<input type="checkbox" name="${indexAns1}"  value="a"   <c:if test="${answer.indexOf(value)>=0}"> checked="checked"</c:if>  > A、${resourceQuestion.option.optionA}--%>
                                            <%--</div>--%>
                                            <%--<div class="choice col-md-2" >--%>
                                                <%--<c:set var="value" value="b" />--%>
                                                <%--<input type="checkbox" name="${indexAns1}"  value="b"  <c:if test="${answer.indexOf(value)>=0}"> checked="checked"</c:if>  > B、${resourceQuestion.option.optionB}--%>
                                            <%--</div>--%>
                                            <%--<div class="choice col-md-2" >--%>
                                                <%--<c:set var="value" value="c" />--%>
                                                <%--<input type="checkbox" name="${indexAns1}" value="c"  <c:if test="${answer.indexOf(value)>=0}"> checked="checked"</c:if>  > C、${resourceQuestion.option.optionC}--%>
                                            <%--</div>--%>
                                            <%--<div class="choice col-md-2" >--%>
                                                <%--<c:set var="value" value="d" />--%>
                                                <%--<input type="checkbox" name="${indexAns1}"   value="d"   <c:if test="${answer.indexOf(value)>=0}"> checked="checked"</c:if>  > D、${resourceQuestion.option.optionD}--%>
                                            <%--</div>--%>
                                        <%--</c:if>--%>
                                    <%--</c:forEach>--%>

                                    <%--AlisaYE--%>

                                            <%--<c:set var="quesId" value="${1}" />--%>
                                            <%--<div class="choicea col-md-2" >--%>
                                                <%--<c:set var="value" value="a" />--%>
                                                <%--<c:forEach var="teachStudentPaper" items="${teachStudentPaper}">--%>
                                                <%--<c:if test="${teachStudentPaper.questionId == indexAns1 }">--%>
                                                <%--<c:set var="answer" value="${teachStudentPaper.answer}" />--%>
                                                <%--<input type="checkbox" name="${indexAns1}"  value="a"   <c:if test="${answer.indexOf(value)>=0}"> checked="checked"</c:if>  >--%>
                                                <%--A、${resourceQuestion.option.optionA}--%>
                                                <%--</c:if>--%>
                                                <%--</c:forEach>--%>
                                            <%--</div>--%>
                                            <%--<div class="choice col-md-2" >--%>
                                                <%--<c:set var="value" value="b" />--%>
                                                <%--<c:forEach var="teachStudentPaper" items="${teachStudentPaper}">--%>
                                                <%--<c:if test="${teachStudentPaper.questionId == indexAns1 }">--%>
                                                <%--<c:set var="answer" value="${teachStudentPaper.answer}" />--%>
                                                <%--<input type="checkbox" name="${indexAns1}"  value="b"  <c:if test="${answer.indexOf(value)>=0}"> checked="checked"</c:if>  >--%>
                                                <%--B、${resourceQuestion.option.optionB}--%>
                                                <%--</c:if>--%>
                                                <%--</c:forEach>--%>
                                            <%--</div>--%>
                                            <%--<div class="choice col-md-2" >--%>
                                                <%--<c:set var="value" value="c" />--%>
                                                <%--<c:forEach var="teachStudentPaper" items="${teachStudentPaper}">--%>
                                                    <%--<c:if test="${teachStudentPaper.questionId == indexAns1 }">--%>
                                                        <%--<c:set var="answer" value="${teachStudentPaper.answer}" />--%>
                                                <%--<input type="checkbox" name="${indexAns1}" value="c"  <c:if test="${answer.indexOf(value)>=0}"> checked="checked"</c:if>  >--%>
                                                <%--C、${resourceQuestion.option.optionC}--%>
                                                <%--</c:if>--%>
                                                <%--</c:forEach>--%>
                                            <%--</div>--%>
                                            <%--<div class="choice col-md-2" >--%>
                                                <%--<c:set var="value" value="d" />--%>
                                                <%--<c:forEach var="teachStudentPaper" items="${teachStudentPaper}">--%>
                                                <%--<c:if test="${teachStudentPaper.questionId == indexAns1 }">--%>
                                                <%--<c:set var="answer" value="${teachStudentPaper.answer}" />--%>
                                                <%--<input type="checkbox" name="${indexAns1}"   value="d"   <c:if test="${answer.indexOf(value)>=0}"> checked="checked"</c:if>  >--%>
                                                <%--D、${resourceQuestion.option.optionD}--%>
                                                <%--</c:if>--%>
                                                <%--</c:forEach>--%>
                                            <%--</div>--%>
                                    <c:forEach var="teachStudentPaper" items="${teachStudentPaper}">
                                    <c:if test="${teachStudentPaper.questionId == indexAns1 }">
                                    <c:set var="answer" value="${teachStudentPaper.answer}" />
                                    </c:if>
                                    </c:forEach>
                                    <%--<div class="choicea col-md-2" >--%>
                                        <div class="choice" >
                                        <c:set var="value" value="a" />

                                                <input type="checkbox" name="${indexAns1}"  value="a"   <c:if test="${answer.indexOf(value)>=0}"> checked="checked"</c:if>  >
                                                A、${resourceQuestion.option.optionA}

                                    </div>
                                    <%--<div class="choice col-md-2" >--%>
                                        <div class="choice" >
                                        <c:set var="value" value="b" />

                                                <input type="checkbox" name="${indexAns1}"  value="b"  <c:if test="${answer.indexOf(value)>=0}"> checked="checked"</c:if>  >
                                                B、${resourceQuestion.option.optionB}

                                    </div>
                                    <%--<div class="choice col-md-2" >--%>
                                        <div class="choice" >
                                        <c:set var="value" value="c" />

                                                <input type="checkbox" name="${indexAns1}" value="c"  <c:if test="${answer.indexOf(value)>=0}"> checked="checked"</c:if>  >
                                                C、${resourceQuestion.option.optionC}

                                    </div>
                                    <%--<div class="choice col-md-2" >--%>
                                        <div class="choice" >
                                        <c:set var="value" value="d" />

                                                <input type="checkbox" name="${indexAns1}"   value="d"   <c:if test="${answer.indexOf(value)>=0}"> checked="checked"</c:if>  >
                                                D、${resourceQuestion.option.optionD}
                                    </div>

                                    <%--AlisaYe--%>
                                </div>
                                <br>
                                <br>
                            </c:if>
                        </div>
                    </c:forEach>
                </div>

            <%--</div>--%>

            <div class="row">
                <div class="col-md-2 col-md-offset-1">
                    <h4 class="b">三、判断题</h4>
                </div>
                <div class="col-md-2 col-md-offset-1">
                    <c:set var="index" value="0" />
                    <c:forEach var="resourceQuestion" items="${resourceQuestionList}">
                        <c:if test="${resourceQuestion.questionType == '2' }">
                            <c:set var="index" value="${index+1}" />
                        </c:if>
                    </c:forEach>
                    <h4 class="b">题目数量：${index}</h4>
                </div>
                <div class="col-md-2 col-md-offset-1">
                    <h4 class="b">每题分值：
                        <c:if test="${resourcePaper.paperType == '1'}">
                            <c:if test="${resourceQuestionListJudement!=null&&fn:length(resourceQuestionListJudement)!=0}">${resourceQuestionListJudement[0].questionScore}</c:if>
                        </c:if>
                        <c:if test="${resourcePaper.paperType == '2'}">
                            <c:if test="${resourcePaper.judementScore !=null}">${resourcePaper.judementScore}</c:if>
                        </c:if>
                    </h4>
                </div>
            </div>
                <div class="col-md-offset-1" style="padding-left: 30px;">
                    <c:set var="index" value="0" />
                    <c:forEach var="resourceQuestion" items="${resourceQuestionList}">
                        <c:set var="indexAns2" value="${resourceQuestion.id}" />
                        <%--<div class="row  choicea">--%>
                            <div class="choicea">
                            <c:if test="${resourceQuestion.questionType == '2' }">
                                <input type="hidden" class="resourceQuestionIdList" value="${resourceQuestion.id}">
                                <input type="hidden" class="resourceQuestionIdListYN" value="${resourceQuestion.id}">
                                <c:set var="index" value="${index+1}" />
                                ${index}、${resourceQuestion.stem}
                                <c:if test="${resourceQuestion!=null&&resourceQuestion.environmentId!=null&&resourceQuestion.environmentId!=''}">
                                    <a style="" href="javascript:experimentOperate('${resourceQuestion.id}')">进入实验</a>
                                </c:if>
                                <div class="row "  >
                                    <br>
                                    <%--<c:forEach var="teachStudentPaper" items="${teachStudentPaper}">--%>
                                        <%--<c:if test="${teachStudentPaper.questionId == indexAns2 }">--%>
                                            <%--<c:set var="answer" value="${teachStudentPaper.answer}" />--%>
                                            <%--&lt;%&ndash;<c:set var="quesId" value="${2}" />&ndash;%&gt;--%>
                                            <%--<div class="choicea col-md-2" >--%>
                                                <%--<c:set var="value" value="a" />--%>
                                                <%--<c:set var="status" value="${teachStudentPaper.answer.equals(value) }" />--%>
                                                <%--<input type="radio" name="${indexAns2}"    value="a"  <c:if test="${answer eq value}"> checked="checked"</c:if>  > A、${resourceQuestion.option.optionA}--%>
                                            <%--</div>--%>
                                            <%--<div class="choice col-md-2" >--%>
                                                <%--<c:set var="value" value="b" />--%>
                                                <%--<input type="radio" name="${indexAns2}"   value="b"  <c:if test="${answer eq value}"> checked="checked"</c:if> > B、${resourceQuestion.option.optionB}--%>
                                            <%--</div>--%>
                                        <%--</c:if>--%>
                                    <%--</c:forEach>--%>

                                    <%--AlisaYE--%>

                                            <%--<c:set var="quesId" value="${2}" />--%>
                                            <%--<div class="choicea col-md-2" >--%>
                                                <%--<c:set var="value" value="a" />--%>
                                                <%--<c:forEach var="teachStudentPaper" items="${teachStudentPaper}">--%>
                                                <%--<c:if test="${teachStudentPaper.questionId == indexAns2 }">--%>
                                                <%--<c:set var="answer" value="${teachStudentPaper.answer}" />--%>
                                                <%--<input type="radio" name="${indexAns2}"    value="a"  <c:if test="${answer eq value}"> checked="checked"</c:if>  >--%>
                                                <%--A、${resourceQuestion.option.optionA}--%>
                                                <%--</c:if>--%>
                                                <%--</c:forEach>--%>
                                            <%--</div>--%>
                                            <%--<div class="choice col-md-2" >--%>
                                                <%--<c:set var="value" value="b" />--%>
                                                <%--<c:forEach var="teachStudentPaper" items="${teachStudentPaper}">--%>
                                                    <%--<c:if test="${teachStudentPaper.questionId == indexAns2 }">--%>
                                                        <%--<c:set var="answer" value="${teachStudentPaper.answer}" />--%>
                                                <%--<input type="radio" name="${indexAns2}"   value="b"  <c:if test="${answer eq value}"> checked="checked"</c:if> >--%>
                                                <%--B、${resourceQuestion.option.optionB}--%>
                                                <%--</c:if>--%>
                                                <%--</c:forEach>--%>
                                            <%--</div>--%>
                                    <c:forEach var="teachStudentPaper" items="${teachStudentPaper}">
                                    <c:if test="${teachStudentPaper.questionId == indexAns2 }">
                                    <c:set var="answer" value="${teachStudentPaper.answer}" />
                                    </c:if>
                                    </c:forEach>
                                    <%--<div class="choicea col-md-2" >--%>
                                        <div class="choice" >
                                        <c:set var="value" value="a" />

                                                <input type="radio" name="${indexAns2}"    value="a"  <c:if test="${answer eq value}"> checked="checked"</c:if>  >
                                                A、${resourceQuestion.option.optionA}

                                    </div>
                                    <%--<div class="choice col-md-2" >--%>
                                        <div class="choice" >
                                        <c:set var="value" value="b" />

                                                <input type="radio" name="${indexAns2}"   value="b"  <c:if test="${answer eq value}"> checked="checked"</c:if> >
                                                B、${resourceQuestion.option.optionB}

                                    </div>

                                    <%--AlisaYe--%>
                                </div>

                                <br>
                            </c:if>
                        </div>
                    </c:forEach>
                </div>
            <%--</div>--%>

            <div class="row">
                <div class="col-md-2  col-md-offset-1">
                    <h4 class="b">四、简答题</h4>
                </div>

                <div class="col-md-2 col-md-offset-1">
                    <c:set var="index" value="0" />
                    <c:forEach var="resourceQuestion" items="${resourceQuestionList}">
                        <c:if test="${resourceQuestion.questionType == '3' }">
                            <c:set var="index" value="${index+1}" />
                        </c:if>
                    </c:forEach>
                    <h4 class="b">题目数量：${index}</h4>
                </div>
                <div class="col-md-2 col-md-offset-1">
                    <h4 class="b">每题分值：
                        <c:if test="${resourcePaper.paperType == '1'}">
                            <c:if test="${resourceQuestionListShortAnswer!=null&&fn:length(resourceQuestionListShortAnswer)!=0}">
                                ${resourceQuestionListShortAnswer[0].questionScore}
                            </c:if>
                        </c:if>
                        <c:if test="${resourcePaper.paperType == '2'}">
                            <c:if test="${resourcePaper.shortAnswerScore !=null}">
                                ${resourcePaper.shortAnswerScore}
                            </c:if>
                        </c:if>
                    </h4>
                </div>
            </div>

                <div class="col-md-offset-1" style="padding-left: 30px;">
                    <c:set var="index" value="0" />
                    <c:forEach var="resourceQuestion" items="${resourceQuestionList}">
                        <c:set var="indexAns3" value="${resourceQuestion.id}" />
                        <div class="row  choicea">
                            <c:if test="${resourceQuestion.questionType == '3' }">
                                <input type="hidden" class="resourceQuestionIdList" value="${resourceQuestion.id}">
                                <input type="hidden" class="resourceQuestionIdListEA" value="${resourceQuestion.id}">
                                <c:set var="index" value="${index+1}" />
                                ${index}、${resourceQuestion.stem}
                                <c:if test="${resourceQuestion!=null&&resourceQuestion.environmentId!=null&&resourceQuestion.environmentId!=''}">
                                    <a style="" href="javascript:experimentOperate('${resourceQuestion.id}')">进入实验</a>
                                </c:if>
                                <%--<div class="row ">--%>
                                <div>
                                    <c:set var="answer" value="" />
                                    <c:forEach var="teachStudentPaper" items="${teachStudentPaper}">
                                        <c:if test="${teachStudentPaper.questionId == indexAns3 }">
                                            <c:set var="answer" value="${teachStudentPaper.answer}" />
                                        </c:if>
                                    </c:forEach>
                                            <%--<textarea class="col-md-offset-1" style="width:500px;height:200px" name="${indexAns3}" id="TextArea1" >   </textarea>--%>
                                            <%--<textarea class="col-md-offset-1" style="width:500px;height:200px" name="${indexAns3}" id="${indexAns3}" >${teachStudentPaper.answer } </textarea>--%>
                                    <%--<textarea class="col-md-offset-1" style="width:500px;height:200px" name="${indexAns3}" id="${indexAns3}" >${answer} </textarea>--%>
                                    <textarea  style="width:500px;height:200px;padding-left: 15px;margin-top: 15px"  name="${indexAns3}" id="${indexAns3}" >${answer} </textarea>

                                <%--&lt;%&ndash;textarea&ndash;%&gt;<label id="Label1"></label>--%>

                                </div>

                                <br><br>

                                <%--剩余字符:<span id="textleft">256</span>--%>
                            </c:if>
                        </div>
                    </c:forEach>
                </div>

            <%--</div>--%>

            <br>
        </div>

        <div class="form-actions">
                <%--<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>--%>
                <%--点击保存的时候，需要去判断考试时间是否到了，如果考试时间到了，就不能点击保存，显示考试已结束？或者在点击保存跳转到新页面的时候，弹出弹框提示剩余时间或者考试截止时间？--%>
            <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"  onclick="return getAllAnswer0()"/>
                <%--这里的保存和提交没有差别啊。结果都要入库啊。唯一的区别就是，提交之后提交的次数减少了。--%>
                <%--<input  id="btnNoSubmit" class="btn btn-primary" value="保 存" onclick="return getAllAnswer()"/>--%>
            <input id="btnSubmit" class="btn btn-primary" type="submit" value="提 交"  onclick="return getAllAnswer()"/>
                <%--<a id="subbtn" href="javascript:;" onclick="return getAllAnswer()">模拟提交按钮</a>--%>
        </div>
    </div>
    </form:form>
</body>
</html>

